package burp;

import ui.UI2;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by td on 2017/6/29.
 */
public class SqlMenuContextFactory implements IContextMenuFactory {
    private IExtensionHelpers helpers;
    private PrintWriter stdout;
    private UI2.Table table;

    public SqlMenuContextFactory(IExtensionHelpers helpers, PrintWriter stdout, UI2.Table table) {
        this.helpers = helpers;
        this.stdout = stdout;
        this.table = table;
    }

    public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
        List<JMenuItem> jMenuItemList = new ArrayList<JMenuItem>();
        JMenuItem jMenuItem = new JMenuItem("clear sqlInject history");
        jMenuItemList.add(jMenuItem);
        jMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
               // table.getModel();
                DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
                tableModel.setRowCount(0);
            }
        });



        return null;
    }
}
